home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / contrib / agsm.bst < prev    next >
Text File  |  1994-07-31  |  25KB  |  1,351 lines

  1. % BibTeX standard bibliography style `agsm' (one of the harvard family)
  2.     % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
  3.     % Copyright (C) 1991, all rights reserved.
  4.     % Copying of this file is authorized only if either
  5.     % (1) you make absolutely no changes to your copy, including name, or
  6.     % (2) if you do make changes, you name it something other than
  7.     % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, abbrv.bst, agsm.bst,
  8.         % dcu.bst or kluwer.bst.
  9.     % This restriction helps ensure that all standard styles are identical.
  10.     % The file harvard.tex has the documentation for this style.
  11.  
  12. % ACKNOWLEDGEMENT:
  13. %   This document is a modified version of alpha.bst to which it owes much of
  14. %   its functionality.
  15.  
  16. % AUTHOR
  17. %   Peter Williams, Key Centre for Design Quality, Sydney University
  18. %   e-mail: peterw@archsci.arch.su.oz.au
  19.  
  20. ENTRY
  21.   { address
  22.     author
  23.     booktitle
  24.     chapter
  25.     edition
  26.     editor
  27.     howpublished
  28.     institution
  29.     journal
  30.     key
  31.     month
  32.     note
  33.     number
  34.     organization
  35.     pages
  36.     publisher
  37.     school
  38.     series
  39.     title
  40.     type
  41.     URL
  42.     volume
  43.     year
  44.   }
  45.   { field.used etal.allowed etal.required} %%%XXX change
  46.   { extra.label sort.label list.year }
  47.  
  48. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  49.  
  50. FUNCTION {init.state.consts}
  51. { #0 'before.all :=
  52.   #1 'mid.sentence :=
  53.   #2 'after.sentence :=
  54.   #3 'after.block :=
  55. }
  56.  
  57. STRINGS { s t f }
  58.  
  59. FUNCTION {output.nonnull}
  60. { 's :=
  61.   output.state mid.sentence =
  62.     { ", " * write$ }
  63.     { output.state after.block =
  64.     { add.period$ write$
  65.       newline$
  66.       "\newblock " write$
  67.     }
  68.     { output.state before.all =
  69.         'write$
  70.         { add.period$ " " * write$ }
  71.       if$
  72.     }
  73.       if$
  74.       mid.sentence 'output.state :=
  75.     }
  76.   if$
  77.   s
  78. }
  79.  
  80. FUNCTION {output}
  81. { duplicate$ empty$
  82.     'pop$
  83.     'output.nonnull
  84.   if$
  85. }
  86.  
  87. FUNCTION {output.check}
  88. { 't :=
  89.   duplicate$ empty$
  90.     { pop$ "empty " t * " in " * cite$ * warning$ }
  91.     'output.nonnull
  92.   if$
  93. }
  94.  
  95. FUNCTION {item.check}
  96. { 't :=
  97.   empty$
  98.     { "empty " t * " in " * cite$ * warning$ }
  99.     { skip$ }
  100.   if$
  101. }
  102.  
  103. FUNCTION {fin.entry}
  104. { add.period$
  105.   write$
  106.   newline$
  107. }
  108.  
  109. FUNCTION {new.block}
  110. { output.state before.all =
  111.     'skip$
  112.     { after.block 'output.state := }
  113.   if$
  114. }
  115.  
  116. FUNCTION {not}
  117. {   { #0 }
  118.     { #1 }
  119.   if$
  120. }
  121.  
  122. FUNCTION {and}
  123. {   'skip$
  124.     { pop$ #0 }
  125.   if$
  126. }
  127.  
  128. FUNCTION {or}
  129. {   { pop$ #1 }
  130.     'skip$
  131.   if$
  132. }
  133.  
  134. FUNCTION {field.or.null}
  135. { duplicate$ empty$
  136.     { pop$ "" }
  137.     'skip$
  138.   if$
  139. }
  140.  
  141. FUNCTION {emphasize}
  142. { duplicate$ empty$
  143.     { pop$ "" }
  144.     { "{\em " swap$ * "}" * }
  145.   if$
  146. }
  147.  
  148. FUNCTION {embolden}
  149. { duplicate$ empty$
  150.     { pop$ "" }
  151.     { "{\bf " swap$ * "}" * }
  152.   if$
  153. }
  154.  
  155. FUNCTION {quote}
  156. { duplicate$ empty$
  157.     { pop$ "" }
  158.     { "`" swap$ * "'" * }
  159.   if$
  160. }
  161.  
  162. FUNCTION {write.url}
  163. { URL empty$
  164.     { skip$ }
  165.     { "\newline\harvardurl{" URL * "}" * write$ newline$ }
  166.   if$
  167. }
  168.  
  169. INTEGERS { nameptr namesleft numnames }
  170.  
  171. FUNCTION {format.names}
  172. { 's :=
  173.   'f :=
  174.   #1 'nameptr :=
  175.   s num.names$ 'numnames :=
  176.   numnames 'namesleft :=
  177.     { namesleft #0 > }
  178.     { s nameptr f format.name$ 't :=
  179.       nameptr #1 >
  180.     { namesleft #1 >
  181.         { ", " * t * }
  182.         { t "others" =
  183.         { " et~al." * }
  184.         { " \harvardand\ " * t * }
  185.           if$
  186.         }
  187.       if$
  188.     }
  189.     't
  190.       if$
  191.       nameptr #1 + 'nameptr :=
  192.       namesleft #1 - 'namesleft :=
  193.     }
  194.   while$
  195. }
  196.  
  197. FUNCTION {format.authors}
  198. { author empty$
  199.     { "" }
  200.     { "{vv~}{ll}{, jj}{, f.}" author format.names }
  201.   if$
  202. }
  203.  
  204. FUNCTION {format.editors}
  205. { editor empty$
  206.     { "" }
  207.     { "{vv~}{ll}{, jj}{, f.}" editor format.names
  208.       editor num.names$ #1 >
  209.     { ", eds" * }
  210.     { ", ed." * }
  211.       if$
  212.     }
  213.   if$
  214. }
  215.  
  216. FUNCTION {format.editors.reverse}
  217. { editor empty$
  218.     { "" }
  219.     { "{f.~}{vv~}{ll}{, jj}" editor format.names
  220.       editor num.names$ #1 >
  221.     { ", eds" * }
  222.     { ", ed." * }
  223.       if$
  224.     }
  225.   if$
  226. }
  227.  
  228. FUNCTION {format.title}
  229. { title empty$
  230.     { "" }
  231.     { title "t" change.case$ }
  232.   if$
  233. }
  234.  
  235. FUNCTION {n.dashify}
  236. { 't :=
  237.   ""
  238.     { t empty$ not }
  239.     { t #1 #1 substring$ "-" =
  240.     { t #1 #2 substring$ "--" = not
  241.         { "--" *
  242.           t #2 global.max$ substring$ 't :=
  243.         }
  244.         {   { t #1 #1 substring$ "-" = }
  245.         { "-" *
  246.           t #2 global.max$ substring$ 't :=
  247.         }
  248.           while$
  249.         }
  250.       if$
  251.     }
  252.     { t #1 #1 substring$ *
  253.       t #2 global.max$ substring$ 't :=
  254.     }
  255.       if$
  256.     }
  257.   while$
  258. }
  259.  
  260. FUNCTION {format.btitle}
  261. { title emphasize
  262. }
  263.  
  264. FUNCTION {tie.or.space.connect}
  265. { duplicate$ text.length$ #3 <
  266.     { "~" }
  267.     { " " }
  268.   if$
  269.   swap$ * *
  270. }
  271.  
  272. FUNCTION {either.or.check}
  273. { empty$
  274.     'pop$
  275.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  276.   if$
  277. }
  278.  
  279. FUNCTION {format.bvolume}
  280. { volume empty$
  281.     { "" }
  282.     { "Vol." volume tie.or.space.connect
  283.       series empty$
  284.     'skip$
  285.     { " of " * series emphasize * }
  286.       if$
  287.       "volume and number" number either.or.check
  288.     }
  289.   if$
  290. }
  291.  
  292. FUNCTION {format.number.series}
  293. { volume empty$
  294.     { number empty$
  295.     { series field.or.null }
  296.     { output.state mid.sentence =
  297.         { "number" }
  298.         { "Number" }
  299.       if$
  300.       number tie.or.space.connect
  301.       series empty$
  302.         { "there's a number but no series in " cite$ * warning$ }
  303.         { " {\em in} " * series quote * }
  304.       if$
  305.     }
  306.       if$
  307.     }
  308.     { "" }
  309.   if$
  310. }
  311.  
  312. FUNCTION {format.edition}
  313. { edition empty$
  314.     { "" }
  315.     { output.state mid.sentence =
  316.     { edition "l" change.case$ " edn" * }
  317.     { edition "t" change.case$ " edn" * }
  318.       if$
  319.     }
  320.   if$
  321. }
  322.  
  323. INTEGERS { multiresult }
  324.  
  325. FUNCTION {multi.page.check}
  326. { 't :=
  327.   #0 'multiresult :=
  328.     { multiresult not
  329.       t empty$ not
  330.       and
  331.     }
  332.     { t #1 #1 substring$
  333.       duplicate$ "-" =
  334.       swap$ duplicate$ "," =
  335.       swap$ "+" =
  336.       or or
  337.     { #1 'multiresult := }
  338.     { t #2 global.max$ substring$ 't := }
  339.       if$
  340.     }
  341.   while$
  342.   multiresult
  343. }
  344.  
  345. FUNCTION {format.pages}
  346. { pages empty$
  347.     { "" }
  348.     { pages multi.page.check
  349.     { "pp.~" pages n.dashify * }
  350.     { "p.~" pages * }
  351.       if$
  352.     }
  353.   if$
  354. }
  355.  
  356. FUNCTION {format.vol.num.pages}
  357. { volume embolden field.or.null
  358.   number empty$
  359.     'skip$
  360.     { "(" number * ")" * *
  361.       volume empty$
  362.     { "there's a number but no volume in " cite$ * warning$ }
  363.     'skip$
  364.       if$
  365.     }
  366.   if$
  367.   pages empty$
  368.     'skip$
  369.     { duplicate$ empty$
  370.     { pop$ format.pages }
  371.     { ",~" * pages n.dashify * }
  372.       if$
  373.     }
  374.   if$
  375. }
  376.  
  377. FUNCTION {format.chapter.pages}
  378. { chapter empty$
  379.     'format.pages
  380.     { type empty$
  381.     { "chapter" }
  382.     { type "l" change.case$ }
  383.       if$
  384.       chapter tie.or.space.connect
  385.       pages empty$
  386.     'skip$
  387.     { ", " * format.pages * }
  388.       if$
  389.     }
  390.   if$
  391. }
  392.  
  393. FUNCTION {format.in.ed.booktitle}
  394. { booktitle empty$
  395.     { "" }
  396.     { editor empty$
  397.     { "{\em in} " booktitle quote * }
  398.     { "{\em in} " format.editors.reverse * ", " * booktitle quote * }
  399.       if$
  400.     }
  401.   if$
  402. }
  403.  
  404. FUNCTION {empty.misc.check}
  405. { author empty$ title empty$ howpublished empty$
  406.   month empty$ year empty$ note empty$
  407.   and and and and and
  408.   key empty$ not and
  409.     { "all relevant fields are empty in " cite$ * warning$ }
  410.     'skip$
  411.   if$
  412. }
  413.  
  414. FUNCTION {format.thesis.type}
  415. { type empty$
  416.     'skip$
  417.     { pop$
  418.       type "t" change.case$
  419.     }
  420.   if$
  421. }
  422.  
  423. FUNCTION {format.tr.number}
  424. { type empty$
  425.     { "Technical Report" }
  426.     'type
  427.   if$
  428.   number empty$
  429.     { "t" change.case$ }
  430.     { number tie.or.space.connect }
  431.   if$
  432. }
  433.  
  434. FUNCTION {format.article.crossref}
  435. { key empty$
  436.     { journal empty$
  437.     { "need key or journal for " cite$ * " to crossref " * crossref *
  438.       warning$
  439.       ""
  440.     }
  441.     { "in {\em " journal * "\/} \cite{" * crossref * "}" *}
  442.       if$
  443.     }
  444.     { "{\em in} \citeasnoun{" crossref * "}" * }
  445.   if$
  446.  
  447. }
  448.  
  449. FUNCTION {format.book.crossref}
  450. { volume empty$
  451.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  452.       "in "
  453.     }
  454.     { "Vol." volume tie.or.space.connect
  455.       " of " *
  456.     }
  457.   if$
  458.   editor empty$
  459.   editor field.or.null author field.or.null =
  460.   or
  461.     { key empty$
  462.     { series empty$
  463.         { "need editor, key, or series for " cite$ * " to crossref " *
  464.           crossref * warning$
  465.           "" *
  466.         }
  467.         { "{\em " * series * "\/} \cite{" * crossref * "}" *}
  468.       if$
  469.     }
  470.     { " \citeasnoun{" * crossref * "}" * }
  471.       if$
  472.     }
  473.     { " \citeasnoun{" * crossref * "}" * }
  474.   if$
  475. }
  476.  
  477. FUNCTION {format.incoll.inproc.crossref}
  478. { editor empty$
  479.   editor field.or.null author field.or.null =
  480.   or
  481.     { key empty$
  482.     { booktitle empty$
  483.         { "need editor, key, or booktitle for " cite$ * " to crossref " *
  484.           crossref * warning$
  485.           ""
  486.         }
  487.         { "in {\em " booktitle * "\/}" * " \cite{" * crossref * "}" *}
  488.       if$
  489.     }
  490.     { "{\em in} \citeasnoun{" crossref * "}" * }
  491.       if$
  492.     }
  493.     { "{\em in} \citeasnoun{" crossref * "}" * }
  494.   if$
  495.   
  496. }
  497.  
  498. INTEGERS { len }
  499.  
  500. FUNCTION {chop.word}
  501. { 's :=
  502.   'len :=
  503.   s #1 len substring$ =
  504.     { s len #1 + global.max$ substring$ }
  505.     's
  506.   if$
  507. }
  508.  
  509. INTEGERS { ind tsslen }
  510.  
  511. STRINGS { tss ret rss istr }
  512.  
  513. FUNCTION {replace.substring}{
  514.   'rss :=
  515.   'tss :=
  516.   'istr :=
  517.   "" 'ret :=
  518.   tss text.length$ 'tsslen :=
  519.   #1 'ind :=
  520.     { istr ind tsslen substring$ "" = not }
  521.     { istr ind tsslen substring$ tss =
  522.         { ret rss * 'ret :=
  523.           ind tsslen + 'ind :=
  524.         }
  525.         { ret istr ind #1 substring$ * 'ret :=
  526.           ind #1 + 'ind :=
  527.         }
  528.       if$
  529.     }
  530.   while$
  531.   ret
  532. }
  533.  
  534. FUNCTION {format.lab.names.abbr}
  535. { 's :=
  536.   s num.names$ 'numnames :=
  537.   numnames #1 >
  538.     { numnames #2 >
  539.     { s #1 "{vv~}{ll}" format.name$ " et~al." * }
  540.     { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  541.             { s #1 "{vv~}{ll}" format.name$ " et~al." * }
  542.         { s #1 "{vv~}{ll}" format.name$ " \harvardand\ " *
  543.               s #2 "{vv~}{ll}" format.name$ * 
  544.             }
  545.           if$
  546.         }
  547.       if$
  548.     }
  549.     { s #1 "{vv~}{ll}" format.name$ }
  550.   if$
  551. }
  552.  
  553. FUNCTION {format.lab.names.full}
  554. { 's :=
  555.   #1 'nameptr :=
  556.   s num.names$ 'numnames :=
  557.   numnames 'namesleft :=
  558.     { namesleft #0 > }
  559.     { s nameptr "{vv~}{ll}" format.name$ 't :=
  560.       nameptr #1 >
  561.     { namesleft #1 >
  562.         { ", " * t * }
  563.         { t "others" =
  564.         { " et~al." * }
  565.         { " \harvardand\ " * t * }
  566.           if$
  567.         }
  568.       if$
  569.     }
  570.     't
  571.       if$
  572.       nameptr #1 + 'nameptr :=
  573.       namesleft #1 - 'namesleft :=
  574.     }
  575.   while$
  576. }
  577.  
  578. INTEGERS { author.field editor.field organization.field title.field key.field }
  579.  
  580. FUNCTION {init.field.constants}
  581. { #0 'author.field :=
  582.   #1 'editor.field :=
  583.   #2 'organization.field :=
  584.   #3 'title.field :=
  585.   #4 'key.field :=
  586. }
  587.  
  588. FUNCTION {make.list.label}
  589. { author.field field.used =
  590.     { format.authors }
  591.     { editor.field field.used =
  592.         { format.editors }
  593.         { organization.field field.used =
  594.             { "The " #4 organization chop.word #3 text.prefix$ }
  595.             { title.field field.used =
  596.                 { format.btitle }
  597.                 { key.field field.used =
  598.                     { key #3 text.prefix$ }
  599.                     { "Internal error :001 on " cite$ * " label" * warning$ }
  600.                   if$
  601.                 }
  602.               if$
  603.             }
  604.           if$
  605.         }
  606.       if$
  607.     }
  608.   if$
  609. }
  610.  
  611. FUNCTION {make.full.label}
  612. { author.field field.used =
  613.     { author format.lab.names.full }
  614.     { editor.field field.used =
  615.         { editor format.lab.names.full }
  616.         { organization.field field.used =
  617.             { "The " #4 organization chop.word #3 text.prefix$ }
  618.             { title.field field.used =
  619.                 { format.btitle }
  620.                 { key.field field.used =
  621.                     { key #3 text.prefix$ }
  622.                     { "Internal error :001 on " cite$ * " label" * warning$ }
  623.                   if$
  624.                 }
  625.               if$
  626.             }
  627.           if$
  628.         }
  629.       if$
  630.     }
  631.   if$
  632. }
  633.  
  634. FUNCTION {make.abbr.label} %%%XXX change
  635. {
  636.   etal.allowed
  637.     { author.field field.used =
  638.         { author format.lab.names.abbr }
  639.         { editor.field field.used =
  640.             { editor format.lab.names.abbr }
  641.             { organization.field field.used =
  642.                 { "The " #4 organization chop.word #3 text.prefix$ }
  643.                 { title.field field.used =
  644.                     { format.btitle }
  645.                     { key.field field.used =
  646.                         { key #3 text.prefix$ }
  647.                         {"Internal error :001 on " cite$ * " label" * warning$ }
  648.                       if$
  649.                     }
  650.                   if$
  651.                 }
  652.               if$
  653.             }
  654.           if$
  655.         }
  656.       if$
  657.     }
  658.     { make.full.label }
  659.   if$
  660. }
  661.  
  662. FUNCTION {output.bibitem}
  663. { newline$
  664.   etal.allowed        %%%XXX change
  665.   etal.required
  666.   and
  667.     {
  668.       "\harvarditem[" write$
  669.       make.abbr.label write$
  670.       "]{" write$
  671.     }
  672.     {
  673.       "\harvarditem{" write$
  674.     }
  675.   if$
  676.   make.full.label write$
  677.   "}{" write$
  678.   list.year write$
  679.   "}{" write$
  680.   cite$ write$
  681.   "}" write$
  682.   newline$
  683.   ""
  684.   before.all 'output.state :=
  685. }
  686.  
  687. FUNCTION {list.label.output}
  688. { make.list.label " " * write$
  689. }
  690.  
  691. FUNCTION {article}
  692. { output.bibitem
  693.   list.label.output
  694.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  695.   author "author" item.check
  696.   title.field field.used =
  697.     { skip$ }
  698.     { format.title quote "title" output.check }
  699.   if$
  700.   crossref missing$
  701.     { journal emphasize "journal" duplicate$ item.check
  702.       " " * format.vol.num.pages * output
  703.     }
  704.     { format.article.crossref output.nonnull
  705.       format.pages output
  706.     }
  707.   if$
  708.   new.block
  709.   note output
  710.   fin.entry
  711.   write.url
  712. }
  713.  
  714. FUNCTION {book}
  715. { output.bibitem
  716.   list.label.output
  717.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  718.   author empty$
  719.     { editor "author and editor" item.check }
  720.     { crossref missing$
  721.     { "author and editor" editor either.or.check }
  722.     'skip$
  723.       if$
  724.     }
  725.   if$
  726.   title.field field.used =
  727.     { skip$ }
  728.     { format.btitle "title" output.check }
  729.   if$
  730.   crossref missing$
  731.     { format.bvolume output
  732.       format.number.series output
  733.       format.edition output
  734.       publisher "publisher" output.check
  735.       address output
  736.     }
  737.     { format.book.crossref output.nonnull
  738.       format.edition output
  739.     }
  740.   if$
  741.   new.block
  742.   note output
  743.   fin.entry
  744.   write.url
  745. }
  746.  
  747. FUNCTION {booklet}
  748. { output.bibitem
  749.   list.label.output
  750.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  751.   title.field field.used =
  752.     { skip$ }
  753.     { format.title quote "title" output.check }
  754.   if$
  755.   howpublished output
  756.   address output
  757.   new.block
  758.   note output
  759.   fin.entry
  760.   write.url
  761. }
  762.  
  763. FUNCTION {inbook}
  764. { output.bibitem
  765.   list.label.output
  766.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  767.   author empty$
  768.     { editor "author and editor" item.check }
  769.     { crossref missing$
  770.     { "author and editor" editor either.or.check }
  771.     'skip$
  772.       if$
  773.     }
  774.   if$
  775.   title.field field.used =
  776.     { skip$ }
  777.     { format.btitle "title" output.check }
  778.   if$
  779.   crossref missing$
  780.     { format.bvolume output
  781.       format.number.series output
  782.       format.edition output
  783.       publisher "publisher" output.check
  784.       address output
  785.     }
  786.     { format.book.crossref output.nonnull
  787.       format.edition output
  788.     }
  789.   if$
  790.   format.chapter.pages "chapter and pages" output.check
  791.   new.block
  792.   note output
  793.   fin.entry
  794.   write.url
  795. }
  796.  
  797. FUNCTION {incollection}
  798. { output.bibitem
  799.   list.label.output
  800.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  801.   title.field field.used =
  802.     { skip$ }
  803.     { format.title "title" output.check }
  804.   if$
  805.   author "author" item.check
  806.   crossref missing$
  807.     { format.in.ed.booktitle "booktitle" output.check
  808.       format.edition output
  809.       format.bvolume output
  810.       format.number.series output
  811.       publisher "publisher" output.check
  812.       address output
  813.     }
  814.     { format.incoll.inproc.crossref output.nonnull
  815.     }
  816.   if$
  817.   format.chapter.pages output
  818.   new.block
  819.   note output
  820.   fin.entry
  821.   write.url
  822. }
  823.  
  824. FUNCTION {inproceedings}
  825. { output.bibitem
  826.   list.label.output
  827.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  828.   title.field field.used =
  829.     { skip$ }
  830.     { format.title "title" output.check }
  831.   if$
  832.   author "author" item.check
  833.   crossref missing$
  834.     { format.in.ed.booktitle "booktitle" output.check
  835.       format.bvolume output
  836.       format.number.series output
  837.       address empty$
  838.     { organization output
  839.       publisher output
  840.     }
  841.     { organization output
  842.       publisher output
  843.           address output.nonnull
  844.      }
  845.       if$
  846.     }
  847.     { format.incoll.inproc.crossref output.nonnull
  848.     }
  849.   if$
  850.   format.pages output
  851.   new.block
  852.   note output
  853.   fin.entry
  854.   write.url
  855. }
  856.  
  857. FUNCTION {conference} { inproceedings }
  858.  
  859. FUNCTION {manual}
  860. { output.bibitem
  861.   list.label.output
  862.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  863.   title.field field.used =
  864.     { skip$ }
  865.     { format.btitle "title" output.check }
  866.   if$
  867.   format.edition output
  868.   author empty$
  869.     { organization empty$
  870.     { address output }
  871.     'skip$
  872.       if$
  873.     }
  874.     { organization output
  875.       address output
  876.     }
  877.   if$
  878.   new.block
  879.   note output
  880.   fin.entry
  881.   write.url
  882. }
  883.  
  884. FUNCTION {mastersthesis}
  885. { output.bibitem
  886.   list.label.output
  887.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  888.   author "author" item.check
  889.   title.field field.used =
  890.     { skip$ }
  891.     { format.title "title" output.check }
  892.   if$
  893.   "Master's thesis" format.thesis.type output.nonnull
  894.   school "school" output.check
  895.   address output
  896.   new.block
  897.   note output
  898.   fin.entry
  899.   write.url
  900. }
  901.  
  902. FUNCTION {misc}
  903. { output.bibitem
  904.   list.label.output
  905.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  906.   title.field field.used =
  907.     { skip$ }
  908.     { format.title quote output }
  909.   if$
  910.   howpublished output
  911.   new.block
  912.   note output
  913.   fin.entry
  914.   write.url
  915.   empty.misc.check
  916. }
  917.  
  918. FUNCTION {phdthesis}
  919. { output.bibitem
  920.   list.label.output
  921.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  922.   author "author" item.check
  923.   title.field field.used =
  924.     { skip$ }
  925.     { title "title" output.check }
  926.   if$
  927.   "PhD thesis" format.thesis.type output.nonnull
  928.   school "school" output.check
  929.   address output
  930.   new.block
  931.   note output
  932.   fin.entry
  933.   write.url
  934. }
  935.  
  936. FUNCTION {proceedings}
  937. { output.bibitem
  938.   list.label.output
  939.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  940.   title.field field.used =
  941.     { skip$ }
  942.     { format.btitle "title" output.check }
  943.   if$
  944.   format.bvolume output
  945.   format.number.series output
  946.   address empty$
  947.     { editor empty$
  948.     { skip$ }
  949.     { organization output
  950.     }
  951.       if$
  952.       publisher output
  953.     }
  954.     { editor empty$
  955.     'skip$
  956.     { organization output }
  957.       if$
  958.       publisher output
  959.       address output.nonnull
  960.     }
  961.   if$
  962.   new.block
  963.   note output
  964.   fin.entry
  965.   write.url
  966. }
  967.  
  968. FUNCTION {techreport}
  969. { output.bibitem
  970.   list.label.output
  971.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  972.   author "author" item.check
  973.   title.field field.used =
  974.     { skip$ }
  975.     { format.title "title" output.check }
  976.   if$
  977.   format.tr.number output.nonnull
  978.   institution "institution" output.check
  979.   address output
  980.   new.block
  981.   note output
  982.   fin.entry
  983.   write.url
  984. }
  985.  
  986. FUNCTION {unpublished}
  987. { output.bibitem
  988.   list.label.output
  989.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  990.   author "author" item.check
  991.   title.field field.used =
  992.     { skip$ }
  993.     { format.title "title" output.check }
  994.   if$
  995.   new.block
  996.   note "note" output.check
  997.   fin.entry
  998.   write.url
  999. }
  1000.  
  1001. FUNCTION {default.type} { misc }
  1002.  
  1003. MACRO {jan} {"January"}
  1004.  
  1005. MACRO {feb} {"February"}
  1006.  
  1007. MACRO {mar} {"March"}
  1008.  
  1009. MACRO {apr} {"April"}
  1010.  
  1011. MACRO {may} {"May"}
  1012.  
  1013. MACRO {jun} {"June"}
  1014.  
  1015. MACRO {jul} {"July"}
  1016.  
  1017. MACRO {aug} {"August"}
  1018.  
  1019. MACRO {sep} {"September"}
  1020.  
  1021. MACRO {oct} {"October"}
  1022.  
  1023. MACRO {nov} {"November"}
  1024.  
  1025. MACRO {dec} {"December"}
  1026.  
  1027. MACRO {acmcs} {"ACM Computing Surveys"}
  1028.  
  1029. MACRO {acta} {"Acta Informatica"}
  1030.  
  1031. MACRO {cacm} {"Communications of the ACM"}
  1032.  
  1033. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  1034.  
  1035. MACRO {ibmsj} {"IBM Systems Journal"}
  1036.  
  1037. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  1038.  
  1039. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  1040.  
  1041. MACRO {ieeetcad}
  1042.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  1043.  
  1044. MACRO {ipl} {"Information Processing Letters"}
  1045.  
  1046. MACRO {jacm} {"Journal of the ACM"}
  1047.  
  1048. MACRO {jcss} {"Journal of Computer and System Sciences"}
  1049.  
  1050. MACRO {scp} {"Science of Computer Programming"}
  1051.  
  1052. MACRO {sicomp} {"SIAM Journal on Computing"}
  1053.  
  1054. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  1055.  
  1056. MACRO {tods} {"ACM Transactions on Database Systems"}
  1057.  
  1058. MACRO {tog} {"ACM Transactions on Graphics"}
  1059.  
  1060. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  1061.  
  1062. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  1063.  
  1064. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  1065.  
  1066. MACRO {tcs} {"Theoretical Computer Science"}
  1067.  
  1068. READ
  1069.  
  1070. EXECUTE {init.field.constants}
  1071.  
  1072. FUNCTION {sortify}
  1073. { purify$
  1074.   "l" change.case$
  1075. }
  1076.  
  1077. FUNCTION {sortify.names}
  1078. { " \harvardand\ " " " replace.substring
  1079.   " et~al." " zzz" replace.substring
  1080.   sortify
  1081. }
  1082.  
  1083. FUNCTION {author.key.label}
  1084. { author empty$
  1085.     { key empty$
  1086.     { title.field 'field.used := }
  1087.     { key.field 'field.used := }
  1088.       if$
  1089.     }
  1090.     { author.field 'field.used := }
  1091.   if$
  1092. }
  1093.  
  1094. FUNCTION {author.editor.key.label}
  1095. { author empty$
  1096.     { editor empty$
  1097.     { key empty$
  1098.         { title.field 'field.used := }
  1099.         { key.field 'field.used := }
  1100.       if$
  1101.       }
  1102.     { editor.field 'field.used := }
  1103.       if$
  1104.     }
  1105.     { author.field 'field.used := }
  1106.   if$
  1107. }
  1108.  
  1109. FUNCTION {author.key.organization.label}
  1110. { author empty$
  1111.     { key empty$
  1112.     { organization empty$
  1113.         { title.field 'field.used := }
  1114.         { organization.field 'field.used := }
  1115.       if$
  1116.     }
  1117.     { key.field 'field.used := }
  1118.       if$
  1119.     }
  1120.     { author.field 'field.used := }
  1121.   if$
  1122. }
  1123.  
  1124. FUNCTION {editor.key.organization.label}
  1125. { editor empty$
  1126.     { key empty$
  1127.     { organization empty$
  1128.         { title.field 'field.used := }
  1129.         { organization.field 'field.used := }
  1130.       if$
  1131.     }
  1132.     { key.field 'field.used := }
  1133.       if$
  1134.     }
  1135.     { editor.field 'field.used := }
  1136.   if$
  1137. }
  1138.  
  1139. FUNCTION {sort.format.title}
  1140. { 't :=
  1141.   "A " #2
  1142.     "An " #3
  1143.       "The " #4 t chop.word
  1144.     chop.word
  1145.   chop.word
  1146.   sortify
  1147.   #1 global.max$ substring$
  1148. }
  1149.  
  1150. FUNCTION {calc.label} %%%XXX change
  1151. { make.abbr.label
  1152.   title.field field.used =
  1153.     { sort.format.title }
  1154.     { sortify.names }
  1155.   if$
  1156.   year field.or.null purify$ #-1 #4 substring$ sortify
  1157.   *
  1158.   'sort.label :=
  1159. }
  1160.  
  1161. FUNCTION {preliminaries} %%%XXX change
  1162. { type$ "book" =
  1163.   type$ "inbook" =
  1164.   or
  1165.     'author.editor.key.label
  1166.     { type$ "proceedings" =
  1167.     'editor.key.organization.label
  1168.     { type$ "manual" =
  1169.         'author.key.organization.label
  1170.         'author.key.label
  1171.       if$
  1172.     }
  1173.       if$
  1174.     }
  1175.   if$
  1176.   author.field field.used = %%%XXX change
  1177.     {
  1178.       author num.names$ #2 >
  1179.         { #1 }
  1180.         { #0 }
  1181.       if$
  1182.       'etal.required :=
  1183.     }
  1184.     {
  1185.       editor.field field.used = 
  1186.         {
  1187.           editor num.names$ #2 >
  1188.             { #1 }
  1189.             { #0 }
  1190.           if$
  1191.         }
  1192.         { #0 }
  1193.       if$
  1194.       'etal.required :=
  1195.     }
  1196.   if$
  1197.   #1 'etal.allowed :=
  1198. }
  1199.  
  1200. FUNCTION {first.presort}
  1201. { calc.label
  1202.   sort.label
  1203.   title.field field.used =
  1204.     { skip$ }
  1205.     { "    "
  1206.       *
  1207.       make.list.label sortify.names
  1208.       *
  1209.       "    "
  1210.       *
  1211.       title field.or.null
  1212.       sort.format.title
  1213.       *
  1214.     }
  1215.   if$
  1216.   #1 entry.max$ substring$
  1217.   'sort.key$ :=
  1218. }
  1219.  
  1220. ITERATE {preliminaries}
  1221.  
  1222. ITERATE {first.presort}
  1223.  
  1224. SORT
  1225.  
  1226. STRINGS { last.sort.label next.extra last.full.label}
  1227.  
  1228. INTEGERS { last.extra.num last.etal.allowed}
  1229.  
  1230. FUNCTION {initialize.confusion}
  1231. { #0 int.to.chr$ 'last.sort.label :=
  1232.   #0 int.to.chr$ 'last.full.label :=
  1233.   #1 'last.etal.allowed :=
  1234. }
  1235.  
  1236. FUNCTION {confusion.pass}
  1237. { last.sort.label sort.label =
  1238.     { last.etal.allowed 
  1239.         { last.full.label make.full.label sortify.names =
  1240.             { skip$ }
  1241.             { #0 'etal.allowed :=
  1242.               #0 'last.etal.allowed :=
  1243.             }
  1244.           if$
  1245.         }
  1246.         { #0 'etal.allowed := }
  1247.       if$
  1248.     }
  1249.     { sort.label 'last.sort.label :=
  1250.       make.full.label sortify.names 'last.full.label :=
  1251.       #1 'last.etal.allowed :=
  1252.     }
  1253.   if$
  1254. }
  1255.  
  1256. EXECUTE {initialize.confusion}
  1257.  
  1258. ITERATE {confusion.pass}
  1259.  
  1260. EXECUTE {initialize.confusion}
  1261.  
  1262. REVERSE {confusion.pass}
  1263.  
  1264. FUNCTION {initialize.last.extra.num}
  1265. { #0 int.to.chr$ 'last.sort.label :=
  1266.   "" 'next.extra :=
  1267.   #0 'last.extra.num :=
  1268. }
  1269.  
  1270. FUNCTION {forward.pass}
  1271. { last.sort.label sort.label =
  1272.     { last.extra.num #1 + 'last.extra.num :=
  1273.       last.extra.num int.to.chr$ 'extra.label :=
  1274.     }
  1275.     { "a" chr.to.int$ 'last.extra.num :=
  1276.       "" 'extra.label :=
  1277.       sort.label 'last.sort.label :=
  1278.     }
  1279.   if$
  1280. }
  1281.  
  1282. FUNCTION {reverse.pass}
  1283. { next.extra "b" =
  1284.     { "a" 'extra.label := }
  1285.     'skip$
  1286.   if$
  1287.   year empty$
  1288.     { "n.d." extra.label emphasize * 'list.year := }
  1289.     { year extra.label emphasize * 'list.year := }
  1290.   if$
  1291.   extra.label 'next.extra :=
  1292. }
  1293.  
  1294. ITERATE {first.presort}
  1295.  
  1296. SORT
  1297.  
  1298. EXECUTE {initialize.last.extra.num}
  1299.  
  1300. ITERATE {forward.pass}
  1301.  
  1302. REVERSE {reverse.pass}
  1303.  
  1304. FUNCTION {second.presort}
  1305. { make.list.label
  1306.   title.field field.used =
  1307.     { sort.format.title }
  1308.     { sortify.names }
  1309.   if$
  1310.   "    "
  1311.   *
  1312.   list.year field.or.null sortify
  1313.   *
  1314.   "    "
  1315.   *
  1316.   title.field field.used =
  1317.     { skip$ }
  1318.     { title field.or.null
  1319.       sort.format.title
  1320.       *
  1321.     }
  1322.   if$
  1323.   #1 entry.max$ substring$
  1324.   'sort.key$ :=
  1325. }
  1326.  
  1327. ITERATE {second.presort}
  1328.  
  1329. SORT
  1330.  
  1331. FUNCTION {begin.bib}
  1332. { preamble$ empty$
  1333.     'skip$
  1334.     { preamble$ write$ newline$ }
  1335.   if$
  1336.   "\begin{thebibliography}{xx}" write$ newline$
  1337. }
  1338.  
  1339. EXECUTE {begin.bib}
  1340.  
  1341. EXECUTE {init.state.consts}
  1342.  
  1343. ITERATE {call.type$}
  1344.  
  1345. FUNCTION {end.bib}
  1346. { newline$
  1347.   "\end{thebibliography}" write$ newline$
  1348. }
  1349.  
  1350. EXECUTE {end.bib}
  1351.